package br.com.emvista.model.exception;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import br.com.emvista.model.facades.ValidationError;

public class EmvistaException extends Exception {

	private static final long serialVersionUID = 1881976068818711191L;

	private final List<ValidationError> messages;

	public List<ValidationError> getMessages() {
		return messages;
	}

	public EmvistaException() {
		this.messages = Collections.unmodifiableList(new ArrayList<ValidationError>());
	}

	public EmvistaException(List<ValidationError> messages) {
		this.messages = Collections.unmodifiableList(messages);
	}

	public EmvistaException(String mensagem) {
		super(mensagem);
		this.messages = Collections.unmodifiableList(new ArrayList<ValidationError>());
	}
	
	public EmvistaException(String mensagem, List<ValidationError> messages) {
		super(mensagem);
		this.messages = Collections.unmodifiableList(messages);
	}

	public EmvistaException(Throwable arg0, List<ValidationError> messages) {
		super(arg0);
		this.messages = Collections.unmodifiableList(messages);
	}

	public EmvistaException(String message, Throwable inner) {
		super(inner);
		this.messages = Collections.unmodifiableList(new ArrayList<ValidationError>());
	}
	
	public EmvistaException(String arg0, Throwable arg1, List<ValidationError> messages) {
		super(arg0, arg1);
		this.messages = Collections.unmodifiableList(messages);
	}

}
